﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrimaryAlgorithm.ClimbStairs
{
    /// <summary>
    /// 爬楼梯
    /// </summary>
    class MainProject
    {
        static void Main(string[] args)
        {
          
            Console.WriteLine(ClimbStairs(5));
            Console.ReadKey();
        }
        public static int ClimbStairs(int n)
        {
            //if (n <= 3)
            //{
            //    return n;
            //}

            //return ClimbStairs(n - 1) + ClimbStairs(n - 2);
            return Climb(n, 1, 1);
        }
        public static int Climb(int n,int a,int b)
        {
            if (n <= 1)
            {
                return b;
            }

            return Climb(n - 1, b, a + b);
        }
    }
}
